引导服务器

    下表显示了 ServerBootstrap 的方法

    Table 9.2 Methods of ServerBootstrap‘

    如何引导一个服务器

    图9.3显示了 ServerChannel 创建 ServerBootstrap 在 bind(),后者管理大量的子 Channel。

    1. 接收新连接给每个子管道
    2. 接收连接的 Channel

    记住 child* 的方法都是操作在子的 Channel,被 ServerChannel 管理。

    清单9.4 ServerBootstrap 时会创建一个 NioServerSocketChannel实例 bind() 。这个 NioServerChannel 负责接受新连接和创建NioSocketChannel 实例。

    1. 指定 EventLoopGroup 用于从注册的 ServerChannel 中获取EventLoop 和接收到的管道
    2. 指定要使用的管道类
    3. 通过配置引导来绑定管道